<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>编辑用户</title>
 	<link href="<%=path %>/css/selectTable.css" rel="stylesheet" type="text/css" media="screen"/>
  	<script src="<%=path %>/js/jquery-ui-1.8.18.custom.min.js" type="text/javascript"></script>
  	<script src="<%=path %>/js/jquery-selectTable.js" type="text/javascript"></script>
  	<script src="<%=path %>/js/util.js" type="text/javascript"></script>
    <title>编辑用户</title>
  </head>
  <body>
	<div class="pageContent">
		<form method="post" action="<%=path %>/roles/saveRoles.action" class="pageForm required-validate" onsubmit="return validateCallback(this, navTabAjaxDone);">
			<div class="pageFormContent" layoutH="56">
				<input name="rolesVO.id" type="hidden" value="<s:property value="rolesVO.id" />" />

				<p>
					<label>角色名称：</label>
					<input name="rolesVO.name" value="<s:property value="rolesVO.name" />" class="required" type="text" size="30" alt="请输入角色名称"/>
				</p>
				<p>
					<label>角色类型：</label>
					<select name="rolesVO.roleType">
                        <option value="">选择角色类型</option>
                        <c:forEach var="item" items="${roleTypes}">
                        	<c:if test="${SESSION_USER.customer ==null}">
                        		<option value="${item.name}" ${rolesVO.roleType eq item.name?"selected":"" }>${item.title}</option>
                        	</c:if>
                        	<c:if test="${SESSION_USER.customer !=null && item.name != 'SUPPER'}">
                        		<option value="${item.name}" ${rolesVO.roleType eq item.name?"selected":"" }>${item.title}</option>
                        	</c:if>
                        </c:forEach>
                   </select>
				</p>
				<!-- 
				 
				<p>
					<label>权限：</label>
					<input name="rolesVO.permissions" value="<s:property value="rolesVO.permissions" />" class="required" type="text" size="30" alt="请输入权限"/>
				</p>
				
				<p>
					<label>创建日期：</label>
					<input name="rolesVO.createDate" value="<s:property value="rolesVO.createDate" />" class="required" type="text" size="30" alt="请输入创建日期"/>
				</p>
				<p>
					<label>创建人：</label>
					<input name="rolesVO.creator" value="<s:property value="rolesVO.creator" />" class="required" type="text" size="30" alt="请输入创建人"/>
				</p>-->
				<p>
					<label>所属商家：</label>
					<input type="hidden" value="${rolesVO.customer.id}" name="rolesVO.customerId"/>
					<input id="active_edit_inp_customerName" name="rolesVO.customerName" value="${rolesVO.customer.name}" type="text" style="width:200px" readonly="readonly" tit="请选择商家！"/>
					<c:if test="${SESSION_USER.customer==null}">
					<a class="btnLook" href="<%=path%>/customer/listCustomer.action?searchType=active" lookupGroup="rolesVO"></a>
					</c:if>
				</p>
				<p>
					<label>说明：</label>
					<input name="rolesVO.description" value="<s:property value="rolesVO.description" />"  type="text" size="30" alt="请输入说明"/>
				</p>
				<div id="selection" class="tabCot"></div>
			</div>
			<div class="formBar">
				<ul>
					<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
					<li>
						<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
					</li>
				</ul>
			</div>
		</form>
	</div>
  </body>
<script type="text/javascript">
  $("#selection").selectTable({
		url : "<%=path %>/ajax/getPermissionSelection.do",
		data : {roleId:'${rolesVO.id}',reqTime: new Date().getTime()},
		leftTitle : "可分配权限",
		rightTitle : "已分配权限",
		filter : true,
		defaultFilterValue : "输入权限..."
	});
</script>
</html>